package cn.itcast.controller.stat;

import cn.itcast.controller.BaseContorller;
import cn.itcast.service.stat.StatService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/stat")
public class StatController extends BaseContorller {
    @Reference
    private StatService statService;


    @RequestMapping(value = "/toCharts",name = "跳转到显示图表页面")
    public String toCharts(String chartsType){
        return "/stat/stat-"+chartsType;
    }
    @RequestMapping(value = "/factoryCharts",name = "每个厂家销售金额的统计")
    @ResponseBody
    public List<Map> factoryCharts(){
        return statService.factoryCharts(getCompanyId());

    }

    @RequestMapping(value = "/sellCharts",name = "产品销量统计")
    @ResponseBody
    public List<Map> sellCharts(){
        return statService.sellCharts(getCompanyId());

    }
    @RequestMapping(value = "/onlineCharts",name = "24小时系统访问压力统计")
    @ResponseBody
    public List<Map> onlineCharts(){
        return statService.onlineCharts(getCompanyId());

    }
}
